package com.xuecheng.base.exception;

import lombok.Getter;

/**
 * @author luhao
 * @ClassName XuChengException.java
 * @Description 自定义异常
 * @createTime 2023/5/18
 */
public class XuChengException extends RuntimeException {
    private String message;
    @Getter
    private String errCode;
    public XuChengException(String message,String errCode){
        super(message);
        this.errCode = errCode;
        this.message = message;
    }
    public XuChengException(){

    }
    public XuChengException(String message){
        super(message);
        this.message = message;
    }
    public static void cast(String message){
        throw new XuChengException(message);
    }
    public static void cast(String message,String errCode){
        throw new XuChengException(message,errCode);
    }
    public static void cast(CommonError error){
        throw new XuChengException(error.getErrMessage());
    }
}
